package cn.teawooo.tree.mvnpro;

import cn.teawooo.tree.AbstractTree;
import cn.teawooo.tree.TreeIterator;

/**
 * 功能描述：
 * @author teawooo <long1795@gmail.com>
 * @time 2013年8月26日 下午3:31:40
 */
public class MvnTree extends AbstractTree<MvnNode> {

    public MvnTree() {
        super();
    }

    public MvnTree(MvnNode root) {
        super(root);
    }

    @Override
    protected TreeIterator<MvnNode> getDefaultIterator() {
        return new TreeIterator<MvnNode>() {
            @Override
            public void doIterateImpl(MvnNode node, int currLevel) {
                StringBuffer log = new StringBuffer();
                for (int i = 0; i++ < currLevel;) {
                    log.append("-");
                }
                log.append(currLevel).append("=").append(node.getData().getGroupId()).append(".")
                        .append(node.getData().getArtifactId()).append(".").append(node.getData().getPackaging());
                logger.info(log.toString());
            }
        };
    }
}
